home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / djgpp / contrib / dvx / inc / x11 / xos.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-15  |  4.5 KB  |  208 lines

  1. /*
  2.  * $XConsortium: Xos.h,v 1.24 89/12/18 16:14:23 rws Exp $
  3.  * 
  4.  * Copyright 1987 by the Massachusetts Institute of Technology
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software and its
  7.  * documentation for any purpose and without fee is hereby granted, provided 
  8.  * that the above copyright notice appear in all copies and that both that 
  9.  * copyright notice and this permission notice appear in supporting 
  10.  * documentation, and that the name of M.I.T. not be used in advertising
  11.  * or publicity pertaining to distribution of the software without specific, 
  12.  * written prior permission. M.I.T. makes no representations about the 
  13.  * suitability of this software for any purpose.  It is provided "as is"
  14.  * without express or implied warranty.
  15.  *
  16.  * The X Window System is a Trademark of MIT.
  17.  *
  18.  */
  19.  
  20. /* This is a collection of things to try and minimize system dependencies
  21.  * in a "signficant" number of source files.
  22.  */
  23.  
  24. #ifndef _XOS_H_
  25. #define _XOS_H_
  26.  
  27. #ifdef MSDOS /* POHC 90/10/08 */
  28. #define SYSV
  29. #endif /* MSDOS */
  30.  
  31. /*
  32.  * Get major data types (esp. caddr_t)
  33.  */
  34.  
  35. #ifdef USG
  36. #ifndef __TYPES__
  37. #ifdef CRAY
  38. #define word word_t
  39. #endif
  40. #include <sys/types.h>            /* forgot to protect it... */
  41. #define __TYPES__
  42. #ifdef CRAY
  43. #undef word
  44. #endif
  45. #endif /* __TYPES__ */
  46. #else
  47. #include <sys/types.h>
  48. #endif /* USG */
  49.  
  50. #ifndef _CADDR_T_DEF_
  51. #ifndef __NDPC__
  52. #ifndef caddr_t /* POHC 91/01/25 */
  53. typedef char *        caddr_t;
  54. #define _CADDR_T_DEF_   /* MJCR/POHC 91/03/01 */
  55. #endif
  56. #endif
  57. #endif
  58.  
  59. /*
  60.  * Just about everyone needs the strings routines.  For uniformity, we use
  61.  * the BSD-style index() and rindex() in application code, so any systems that
  62.  * don't provide them need to have #defines here.  Unfortunately, we can't
  63.  * use #if defined() here since makedepend will get confused.
  64.  *
  65.  * The list of systems that currently needs System V stings includes:
  66.  *
  67.  *    hpux
  68.  *     macII
  69.  *    CRAY
  70.  *    stellar
  71.  *    USG
  72.  *    MSDOS                POHC 90/10/05
  73.  * 
  74.  * all of which happen to define SYSV as well.
  75.  */
  76.  
  77. #ifdef SYSV
  78. #include <string.h>
  79. #define index strchr
  80. #define rindex strrchr
  81. #else
  82. #include <strings.h>
  83. #endif /* SYSV */
  84.  
  85.  
  86. /*
  87.  * Get open(2) constants
  88.  */
  89. #ifdef SYSV
  90. #ifndef macII
  91. #include <fcntl.h>
  92. #endif
  93. #endif /* SYSV */
  94. #ifndef MSDOS /* POHC 91/01/28 */ 
  95. #include <sys/file.h>
  96. #endif /* MSDOS */
  97. #ifdef USG
  98. #include <unistd.h>
  99. #endif
  100.  
  101. #ifdef MSDOS /* 90/06/20 POHC */
  102. #if 0 /* POHC */
  103. #include <fcntl.h>
  104. #endif
  105. #ifndef F_SETFL /* POHC 91/01/16 */
  106. /* fcntl(2) requests */
  107. #define    F_DUPFD        0    /* Duplicate fildes */
  108. #define    F_GETFD        1    /* Get fildes flags */
  109. #define    F_SETFD        2    /* Set fildes flags */
  110. #define    F_GETFL        3    /* Get file flags */
  111. #define    F_SETFL        4    /* Set file flags */
  112. #define    F_GETLK        5    /* Get file lock */
  113. #define    F_SETLK        6    /* Set file lock */
  114. #define    F_SETLKW    7    /* Set file lock and wait */
  115. #define    F_CHKFL        8    /* reserved */
  116. #define    F_ALLOCSP    10    /* reserved */
  117. #define    F_FREESP    11    /* reserved */
  118. #define F_CHSIZE    0x6000     /* XENIX chsize() system call */    
  119. #define F_RDCHK        0x6001    /* XENIX rdchk() system call */
  120. #endif
  121.  
  122. #define R_OK 4 /* Test for Read permission */
  123. #define W_OK 2 /* Test for Write permission */
  124. #define X_OK 1 /* Test for eXecute permission */
  125. #define F_OK 0 /* Test for existence of File */
  126.  
  127. #endif
  128.  
  129. /*
  130.  * Get struct timeval
  131.  */
  132.  
  133. #ifdef SYSV
  134. #if defined(sgi) || defined(CRAY2) || defined(stellar)
  135. #include <sys/time.h>                /* SYSV sys/time.h */
  136. #ifdef CRAY2
  137. #include <time.h>
  138. #define __TIMEVAL__
  139. #endif
  140. #else
  141. #include <time.h>                /* else SYSV time.h */
  142. #endif
  143.  
  144. #if defined(USG)
  145. #ifndef __TIMEVAL__
  146. #define __TIMEVAL__
  147. struct timeval {
  148.     long tv_sec;
  149.     long tv_usec;
  150. };
  151. struct timezone {
  152.     int tz_minuteswest;
  153.     int tz_dsttime;
  154. };
  155. #endif /* __TIMEVAL__ */
  156. #endif /* USG */
  157.  
  158. #ifdef macII
  159. #include <sys/time.h>                /* SYSV && macII */
  160. #endif
  161.  
  162. #else
  163. #include <sys/time.h>                /* else bsd */
  164. #endif
  165.  
  166. #ifdef MSDOS /* POHC 92/08/19 */
  167. #include <sys/time.h>
  168. #include <sys/uio.h>
  169. #endif
  170.  
  171. /*
  172.  * More BSDisms
  173.  */
  174.  
  175. #ifdef SYSV
  176. #ifndef macII
  177. #ifndef ibm
  178. #define SIGCHLD SIGCLD
  179. #endif
  180. #endif
  181. #endif
  182.  
  183.  
  184. /*
  185.  * Put system-specific definitions here
  186.  */
  187.  
  188. #ifdef hpux
  189. #define sigvec sigvector
  190. #endif
  191.  
  192. #if defined(MSDOS) && !defined(__GNUC__) && !defined(__SALFORD__) /* 90/06/25 POHC */
  193. #define bcopy(a,b,c)    memcpy(b,a,c)
  194. #define bcmp(a,b,c)     memcmp(a,b,c)
  195. #define bzero(a,b)      memset(a,0,b)
  196.  
  197. #ifndef index
  198. #define index        strchr
  199. #endif
  200.  
  201. #ifndef rindex
  202. #define rindex        strrchr
  203. #endif
  204.  
  205. #endif
  206.  
  207. #endif /* _XOS_H_ */
  208.